﻿#pragma execution_character_set("utf-8")
#include "EveningState.h"
#include <QDebug>
#include "RestState.h"
#include "SleepingState.h"

EveningState::EveningState()
{

}

void EveningState::WriteProgram(shared_ptr<Work> work)
{
    if (work->getFinish()) {
        work->setCurrent(shared_ptr<RestState>(new RestState()));
        work->WriteProgram();
    }
    else {
        if (work->getHour() < 21) {
            qDebug() << QString("当前时间：%1点 加班哦，疲累之极").arg(work->getHour());
        }
        else {
            work->setCurrent(shared_ptr<SleepingState>(new SleepingState()));
        }
    }
}
